﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Web;
using System.Text;
using System.Runtime.Serialization.Json;
using TwitterWrapper;

namespace TwitterWrapper
{
    public class TwitterStatus
    {
        private string username = null;
        private string password = null;

        public TwitterStatus()
        {
        }

        public TwitterStatus(string name, string pword)
        {
            username = name;
            password = pword;
        }

        public Stream FriendsTimeline()
        {
            return TwitterCom.HTTPGet(@"http://twitter.com/statuses/friends_timeline.json", username, password);
        }

        public Stream UserTimeline(string id)
        {
            return TwitterCom.HTTPGet(@"http://twitter.com/statuses/user_timeline/"+id+".json", username, password);
        }

        //public TStatus[] show()
        //{
        //}

        public Stream Update(string update)
        {
            return TwitterCom.HTTPPost(@"http://twitter.com/statuses/update.json?status=" + HttpUtility.UrlEncode(update, Encoding.UTF8) + "&source=TwitterBEIS", username, password);
        }

        public Stream Replies()
        {
            return TwitterCom.HTTPGet(@"http://twitter.com/statuses/replies.json", username, password);
        }

        //public TStatus destroy(string id)
        //{
        //    Stream stream = null;
        //    try
        //    {
        //        stream = TwitterCom.HTTPPost(@"http://twitter.com/statuses/destroy/"+id+".json", username, password);
        //    }
        //    catch (Exception e)
        //    {
        //        if (stream != null)
        //        {
        //            StreamReader reader = new StreamReader(stream);
        //            throw new Exception(reader.ReadToEnd());
        //        }
        //        else
        //        {
        //            throw e;
        //        }
        //    }

        //    return Json.ReadStatus(stream);
        //}
    }
}
